<!DOCTYPE html>
 <html lang="zh-CN">
 <head>
     <meta charset="UTF-8">
     <title>...</title>
     <!--在IE浏览器中运行最新的渲染模式-->
     <meta http-equiv="X-UA-Compatible" content="IE-Edge">
     <!--初始化移动浏览器显示-->
     <meta name="viewport" content="width-device-width,inital-scale=1">
     <link href="./bootstrap.min.css" rel="stylesheet">
     <!-- <link rel="stylesheet" type="text/css" href="index.css"> -->
     <script src="./jquery-3.4.1.min.js"></script>
       <script src="./bootstrap.min.js"></script>
       <script type="text/javascript">
           $(document).ready(function(){
               var value = 0;
               var time = 100;
               //进度条复位函数
               function reset( ) {
                 value = 0
                   $("#prog").removeClass("progress-bar-success").css("width","0%").text("等待启动");
                   //setTimeout(increment,5000);
               }
               //百分数增加，0-30时为红色，30-60为黄色，60-90为蓝色，>90为绿色
               function increment( ) {
                   value += 1;
                   $("#prog").css("width",value + "%").text(value + "%");
                   if (value>=0 && value<=30) {
                       $("#prog").addClass("progress-bar-success");
                   }
                   else if (value>=30 && value <=60) {
                       $("#prog").removeClass("progress-bar-success");
                       $("#prog").addClass("progress-bar-warning");
                   }
                   else if (value>=60 && value <=90) {
                       $("#prog").removeClass("progress-bar-warning");
                       $("#prog").addClass("progress-bar-info");
                   }
                   else if(value >= 90 && value<100) {
                       $("#prog").removeClass("progress-bar-info");
                       $("#prog").addClass("progress-bar-danger");    
                   }
                   else{
                       setTimeout(reset,3000);
                       return;
 
                   }
 
                   st = setTimeout(increment,time);
               }
 
               increment();
               //进度条停止与重新开始
               $("#stop").click(function () {
                   if ("stop" == $("#stop").val()) {
                       //$("#prog").stop();
                       clearTimeout(st);
                       $("#prog").css("width","0%").text("等待启动");
                       $("#stop").val("start").text("重新开始");
                   } else if ("start" == $("#stop").val()) {
                       increment();
                       $("#stop").val("stop").text("停止");                      
                   }
               });
               //进度条暂停与继续
               $("#pause").click(function() {
                   if ("pause" == $("#pause").val()) {
                       //$("#prog").stop();
                       clearTimeout(st);
                       $("#pause").val("goon").text("继续");
                   } else if ("goon" == $("#pause").val()) {
                       increment();
                       $("#pause").val("stop").text("暂停");
                   }
               });
               $("#stop1").click(function () {
                   if ("stop" == $("#stop").val()) {
                       //$("#prog").stop();
                       clearTimeout(st);
                       $("#prog").css("width","100%").text("考试结束");}
                //        $("#stop").val("start").text("重新开始");
                //    } else if ("start" == $("#stop").val()) {
                //        increment();
                //        $("#stop").val("stop").text("停止");                      
                //    }
               });
           });
       </script>
 </head>
 <body>
            
</body>
</html>